package cn.edu.ujn.booking.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.edu.ujn.booking.dao.User;
import cn.edu.ujn.booking.dao.UserMapper;

@Service
public class UserServiceImpl implements UserService{
	@Autowired
	private UserMapper userMapper;

	

	@Override
	public User findUser(String username, String password) {
		// TODO 自动生成的方法存根
		User user = userMapper.findUser(username, password);
		return user;
	}

	@Override
	public User findUserByUsername(String username) {
		// TODO 自动生成的方法存根
		User user = userMapper.findUserByUsername(username);
		return user;
	}

	@Override
	public User addUser(String username, String password,String identity) {
		// TODO 自动生成的方法存根
		User user = new User();
		user.setUsername(username);
		user.setPassword(password);
		user.setIdentity(identity);
		int insert = userMapper.insert(user);
		return user;
	}

	@Override
	public List<User> findUserByIdentity(String identity) {
		// TODO 自动生成的方法存根
		List<User> identity2 = userMapper.findByIdentity(identity);
		return identity2;
	}

	@Override
	public int deleteUser(int id) {
		// TODO 自动生成的方法存根
		int delete = userMapper.delete(id);
		return delete;
	}

	

}
